/**
 * @author 徐楠
 * @date 2022/3/3 22:27
 * @version 1.0
 */

package com.xunan.likou;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FindAllMissingNumbersInTheArray {
    public static void main(String[] args) {
        int[] nums = {1,1};
        List<Integer> disappearedNumbers = findDisappearedNumbers(nums);
        for (Integer disappearedNumber : disappearedNumbers) {
            System.out.println(disappearedNumber);
        }

    }

    public static List<Integer> findDisappearedNumbers(int[] nums) {
        int length = nums.length;
        Map<Integer, Integer> map = new HashMap<>();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            map.put(nums[i], 1);
        }
        for (int i = 1; i <= length; i++) {
            if (!map.containsKey(i)) {
                list.add(i);
            }
        }
        return list;
    }
}
